Programming: Everyday Decision-Making Algorithms
Kühne Logistics University Hamburg - Winter 2024
Tip
We really appreciate active participation and interaction!
Tip
No worries, we will help you out if you have any questions!
Tip
This is just in order to provide you with working solutions after each deadline.
We will mostly not cover Python during the lectures!
Question: Anybody know why?
Tip
Don’t worry, we will help you out if you have any questions!
Tip
We are convinced that this course will be quite interesting and teach you more for your daily life than most other courses!
Warning
But you should not simply use them to replace your learning.
Tip
Great resources to start are books and small challenges. You can find a list of book recommendations at the end of the lecture. Small challenges to solve can for example be found on Codewars.
Tip
IDE = Integrated Development Environment
Tip
If the installation does not work, let us know!
Tip
Unsure on how to work with VS Code and notebooks? Take a look at the tutorial from VS Code and/or ask us! We are happy to help you out!
Caution
Not all packages available in Python are available here, thus you might need a computer to solve certain problems. For our course, this should not be a problem.
Task: Create a directory for the course and create a new file called hello_world.py with the following code:
Hello, World!
Run it with the green ‘run’ button or by pressing F5!
Note
“Hello world” is a classic example to start with. Often used as a test to check if your computer is working properly and that you have installed the necessary software.
Any questions
so far?
Question: Anybody know what optimal stopping is?
Question: Anybody have an example of optimal stopping?
Photo by Aditya Ghosh on Unsplash
Photo by Scott Graham on Unsplash
Photo by Shelby Deeter on Unsplash
Photo by Joseph Pearson on Unsplash
Note
The name is a bit misleading, as the problem is not about hiring a secretary, but about finding the best candidate. It comes from the 1960s and thus a little outdated.
Ideas?
The optimal strategy is to:
Done - at least for this scenario!
Note
Chance of selecting the best candidate is 37%!
n/ee is the base of the natural logarithm(1 + 1/n)^n as n approaches infinityTip
This is a bit more advanced, so don’t worry if you don’t understand it! We will not go into the details of the math here and focus more on the insights.
We can check this in Python:
Percentage of options to look at: 0.368%
Look at first 7.358 candidates
Note
No worries if you don’t understand the code! We are essentialy just using the formula to calculate the percentage of candidates to look at.
Note
That’s it for todays lecture!
We now have covered a brief introduction into optimal stopping and seen how to set up Python.
Note
The main inspiration for this lecture. Nils and I have read it and discussed it in depth, always wanting to translate it into a course.
Note
Think Python is a great book to start with. It’s available online for free. Schrödinger Programmiert Python is a great alternative for German students, as it is a very playful introduction to programming with lots of examples.
For more interesting literature, take a look at the literature list of this course.
Lecture I - Optimal Stopping | Dr. Tobias Vlćek | Home